home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / doom / quake.zip / QVOTE22.ZIP / VOTE.QC < prev    next >
Text File  |  1996-08-05  |  18KB  |  637 lines

  1. // I don't like prototyping.
  2.  
  3. float noexitdefault = 1;
  4. float teamsdefault = 0;
  5.  
  6. float numplayers;
  7. float exitTotal;    // don't laugh, there are no arrays or lists in QuakeC
  8. float noexitTotal;
  9. float teamtotal;
  10. float noteamtotal;
  11. string p1name;float p1noexit;float p1teamplay;
  12. string p2name;float p2noexit;float p2teamplay;
  13. string p3name;float p3noexit;float p3teamplay;
  14. string p4name;float p4noexit;float p4teamplay;
  15. string p5name;float p5noexit;float p5teamplay;
  16. string p6name;float p6noexit;float p6teamplay;
  17. string p7name;float p7noexit;float p7teamplay;
  18. string p8name;float p8noexit;float p8teamplay;
  19. string p9name;float p9noexit;float p9teamplay;
  20. string p10name;float p10noexit;float p10teamplay;
  21. string p11name;float p11noexit;float p11teamplay;
  22. string p12name;float p12noexit;float p12teamplay;
  23. string p13name;float p13noexit;float p13teamplay;
  24. string p14name;float p14noexit;float p14teamplay;
  25. string p15name;float p15noexit;float p15teamplay;
  26. string p16name;float p16noexit;float p16teamplay;
  27.  
  28. float showedmsg;
  29. //string temps;
  30. /*************************************************************************/
  31. // CountVotes - Self Explanatory
  32. void() countvotes =                          
  33. {
  34.  exitTotal=0;
  35.  noexitTotal=0;
  36.  teamtotal=0;
  37.  noteamtotal=0;
  38.  
  39.          if ( p1name != "" )
  40.           {
  41.            if (p1noexit == 1)
  42.             noexitTotal=noexitTotal + 1;
  43.            else
  44.             exitTotal=exitTotal + 1;
  45.            if (p1teamplay == 1)
  46.             teamtotal=teamtotal + 1;
  47.            else
  48.             noteamtotal=noteamtotal + 1;
  49.           }
  50.  
  51.          if ( p2name != "" )
  52.           {
  53.            if (p2noexit == 1)
  54.             noexitTotal=noexitTotal + 1;
  55.            else
  56.             exitTotal=exitTotal + 1;
  57.            if (p2teamplay == 1)
  58.             teamtotal=teamtotal + 1;
  59.            else
  60.             noteamtotal=noteamtotal + 1;
  61.           }
  62.  
  63.          if ( p3name != "" )
  64.           {
  65.            if (p3noexit == 1)
  66.             noexitTotal=noexitTotal + 1;
  67.            else
  68.             exitTotal=exitTotal + 1;
  69.            if (p3teamplay == 1)
  70.             teamtotal=teamtotal + 1;
  71.            else
  72.             noteamtotal=noteamtotal + 1;
  73.           }
  74.  
  75.          if ( p4name != "" )
  76.           {
  77.            if (p4noexit == 1)
  78.             noexitTotal=noexitTotal + 1;
  79.            else
  80.             exitTotal=exitTotal + 1;
  81.            if (p4teamplay == 1)
  82.             teamtotal=teamtotal + 1;
  83.            else
  84.             noteamtotal=noteamtotal + 1;
  85.           }
  86.  
  87.          if ( p5name != "" )
  88.           {
  89.            if (p5noexit == 1)
  90.             noexitTotal=noexitTotal + 1;
  91.            else
  92.             exitTotal=exitTotal + 1;
  93.            if (p5teamplay == 1)
  94.             teamtotal=teamtotal + 1;
  95.            else
  96.             noteamtotal=noteamtotal + 1;
  97.           }
  98.  
  99.          if ( p6name != "" )
  100.           {
  101.            if (p6noexit == 1)
  102.             noexitTotal=noexitTotal + 1;
  103.            else
  104.             exitTotal=exitTotal + 1;
  105.            if (p6teamplay == 1)
  106.             teamtotal=teamtotal + 1;
  107.            else
  108.             noteamtotal=noteamtotal + 1;
  109.           }
  110.  
  111.          if ( p7name != "" )
  112.           {
  113.            if (p7noexit == 1)
  114.             noexitTotal=noexitTotal + 1;
  115.            else
  116.             exitTotal=exitTotal + 1;
  117.            if (p7teamplay == 1)
  118.             teamtotal=teamtotal + 1;
  119.            else
  120.             noteamtotal=noteamtotal + 1;
  121.           }
  122.  
  123.          if ( p8name != "" )
  124.           {
  125.            if (p8noexit == 1)
  126.             noexitTotal=noexitTotal + 1;
  127.            else
  128.             exitTotal=exitTotal + 1;
  129.            if (p8teamplay == 1)
  130.             teamtotal=teamtotal + 1;
  131.            else
  132.             noteamtotal=noteamtotal + 1;
  133.           }
  134.  
  135.          if ( p9name != "" )
  136.           {
  137.            if (p9noexit == 1)
  138.             noexitTotal=noexitTotal + 1;
  139.            else
  140.             exitTotal=exitTotal + 1;
  141.            if (p9teamplay == 1)
  142.             teamtotal=teamtotal + 1;
  143.            else
  144.             noteamtotal=noteamtotal + 1;
  145.           }
  146.  
  147.          if ( p10name != "" )
  148.           {
  149.            if (p10noexit == 1)
  150.             noexitTotal=noexitTotal + 1;
  151.            else
  152.             exitTotal=exitTotal + 1;
  153.            if (p10teamplay == 1)
  154.             teamtotal=teamtotal + 1;
  155.            else
  156.             noteamtotal=noteamtotal + 1;
  157.           }
  158.  
  159.          if ( p11name != "" )
  160.           {
  161.            if (p11noexit == 1)
  162.             noexitTotal=noexitTotal + 1;
  163.            else
  164.             exitTotal=exitTotal + 1;
  165.            if (p11teamplay == 1)
  166.             teamtotal=teamtotal + 1;
  167.            else
  168.             noteamtotal=noteamtotal + 1;
  169.           }
  170.  
  171.          if ( p12name != "" )
  172.           {
  173.            if (p12noexit == 1)
  174.             noexitTotal=noexitTotal + 1;
  175.            else
  176.             exitTotal=exitTotal + 1;
  177.            if (p12teamplay == 1)
  178.             teamtotal=teamtotal + 1;
  179.            else
  180.             noteamtotal=noteamtotal + 1;
  181.           }
  182.  
  183.          if ( p13name != "" )
  184.           {
  185.            if (p13noexit == 1)
  186.             noexitTotal=noexitTotal + 1;
  187.            else
  188.             exitTotal=exitTotal + 1;
  189.            if (p13teamplay == 1)
  190.             teamtotal=teamtotal + 1;
  191.            else
  192.             noteamtotal=noteamtotal + 1;
  193.           }
  194.  
  195.          if ( p14name != "" )
  196.           {
  197.            if (p14noexit == 1)
  198.             noexitTotal=noexitTotal + 1;
  199.            else
  200.             exitTotal=exitTotal + 1;
  201.            if (p14teamplay == 1)
  202.             teamtotal=teamtotal + 1;
  203.            else
  204.             noteamtotal=noteamtotal + 1;
  205.           }
  206.  
  207.          if ( p15name != "" )
  208.           {
  209.            if (p15noexit == 1)
  210.             noexitTotal=noexitTotal + 1;
  211.            else
  212.             exitTotal=exitTotal + 1;
  213.            if (p15teamplay == 1)
  214.             teamtotal=teamtotal + 1;
  215.            else
  216.             noteamtotal=noteamtotal + 1;
  217.           }
  218.  
  219.          if ( p16name != "" )
  220.           {
  221.            if (p16noexit == 1)
  222.             noexitTotal=noexitTotal + 1;
  223.            else
  224.             exitTotal=exitTotal + 1;
  225.            if (p16teamplay == 1)
  226.             teamtotal=teamtotal + 1;
  227.            else
  228.             noteamtotal=noteamtotal + 1;
  229.           }
  230.  
  231.  
  232.  if (noexitdefault == 1)
  233.   {
  234.    if ( noexitTotal >= exitTotal )
  235.     cvar_set("noexit","1");
  236.    else
  237.     cvar_set("noexit","0");
  238.   }
  239.  else
  240.   {
  241.    if ( noexitTotal > exitTotal )
  242.     cvar_set("noexit","1");
  243.    else
  244.     cvar_set("noexit","0");
  245.   }
  246.  
  247.  if (teamsdefault == 0)
  248.   {
  249.    if ( teamtotal > noteamtotal )
  250.     cvar_set("teamplay","1");
  251.    else
  252.     cvar_set("teamplay","0");
  253.   }
  254.  else
  255.   {
  256.    if ( teamtotal >= noteamtotal )
  257.     cvar_set("teamplay","1");
  258.    else
  259.     cvar_set("teamplay","0");
  260.   }
  261.  
  262.  numplayers=exitTotal+noexitTotal;
  263.  
  264. }; //countvotes
  265.  
  266.  
  267. /*************************************************************************/
  268. //VoteStats - Show vote stats
  269. void(entity self) votestats =
  270.         {
  271.  local string tempstr;
  272.  
  273.          countvotes();
  274.  
  275.          sprint(self, "Allow level exit : ");
  276.          tempstr = ftos(exitTotal);    // sprint(self,ftos(exitTotal)) doesnt 
  277.          sprint(self, tempstr);        // seem to work.
  278.          sprint(self, "\n");
  279.          sprint(self, "Disallow level exit : ");
  280.          tempstr = ftos(noexitTotal);
  281.          sprint(self, tempstr);
  282.          sprint(self, "\n");
  283.  
  284.          sprint(self, "Allow Friendly Fire : ");
  285.          tempstr = ftos(noteamtotal);  
  286.          sprint(self, tempstr);       
  287.          sprint(self, "\n");
  288.          sprint(self, "Disallow Friendly Fire : ");
  289.          tempstr = ftos(teamtotal);
  290.          sprint(self, tempstr);
  291.          sprint(self, "\n");
  292.  
  293.         };                                 
  294.  
  295. /************************************************************************/
  296. // VoteExitYes - Vote for noexit = 0
  297. void(entity self) voteexityes =
  298.       {
  299.        if ( p1name == self.netname )
  300.         p1noexit = 0;
  301.        if ( p2name == self.netname )
  302.         p2noexit = 0;
  303.        if ( p3name == sel